﻿using BoriPeter.FatSecret.Models;
using BoriPeter.FitnessJournal8.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BoriPeter.FatSecret.Converters
{
    public static class WeightsGetMonthConverter
    {
        public static List<DailyEntry> Convert(this WeightsGetMonthModel _inModel)
        {
            if (_inModel.Days != null)
            {
                var retModel = new List<DailyEntry>();
                foreach (var item in _inModel.Days)
                {
                    var weightItem = new DailyEntry();
                    weightItem.Date = item.DateInt.ConvertToDate();
                    weightItem.WeightKg = item.WeightKg;
                    weightItem.WeightComment = item.WeightComment;
                    retModel.Add(weightItem);
                }
                return retModel;
            }
            else
                return new List<DailyEntry>();
        }
    }
}
